package com.chuangjiangx.member.basic.ddd.domain.service.model;

import com.chuangjiangx.member.basic.ddd.domain.model.OperationInfo;
import com.chuangjiangx.domain.shared.model.PayEntry;
import com.chuangjiangx.domain.shared.model.Sex;
import com.chuangjiangx.member.basic.ddd.domain.model.MemberId;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@NoArgsConstructor
public class CreateMember {

    private MemberId id;
    /**
     * 会员姓名
     */
    private String name;

    /**
     * 会员性别
     */
    private Sex sex;

    /**
     * 会员手机号
     */
    private String mobile;
    /**
     * 会员用户头像
     */
    private String headimgurl;

    /**
     * 会员生日
     */
    private Date birthday;

    /**
     * 会员注册的操作信息
     */
    private OperationInfo registerOperationInfo;

    /**
     * 注册时间
     */
    private Date registerTime;

    private String openId;

    private PayEntry payEntry;

    /**
     * 手机号注册会员信息
     *
     * @param name                  会员姓名
     * @param sex                   会员性别
     * @param mobile                会员手机号
     * @param birthday              会员生日
     * @param registerOperationInfo 会员注册的操作信息
     */
    public CreateMember(String name, Sex sex, String mobile, String headimgurl,
                        Date birthday, OperationInfo registerOperationInfo) {
        this.name = name;
        this.sex = sex;
        this.mobile = mobile;
        this.headimgurl = headimgurl;
        this.birthday = birthday;
        this.registerOperationInfo = registerOperationInfo;
        this.registerTime = new Date();
    }

    /**
     * 支付时注册会员信息
     *
     * @param registerOperationInfo 会员注册操作
     * @param payEntry              支付入口
     * @param openId                用户该商户下该支付的唯一标示
     */
    public CreateMember(OperationInfo registerOperationInfo, PayEntry payEntry, String openId) {
        this.registerOperationInfo = registerOperationInfo;
        this.payEntry = payEntry;
        this.openId = openId;
    }
}
